<template>
  <el-dialog title="添加体检" :close-on-click-modal="false"
             :visible.sync="show" width="25%" @close="handleClose"
             :show-close="false">

    <el-form ref="form" :model="exam" label-position="top">
      <el-form-item label="姓名">
        <el-input :value="user.name" disabled></el-input>
      </el-form-item>
      <el-form-item label="联系方式">
        <el-input :value="user.phoneNum" disabled></el-input>
      </el-form-item>
      <el-form-item label="学年">
        <el-radio-group v-model="exam.academicYear">
          <el-radio-button label="1">一</el-radio-button>
          <el-radio-button label="2">二</el-radio-button>
          <el-radio-button label="3">三</el-radio-button>
          <el-radio-button label="4">四</el-radio-button>
        </el-radio-group>
      </el-form-item>
    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button @click="closeDialog">取 消</el-button>
      <el-button type="primary" @click="handleSubmit">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import {mapGetters} from "vuex";

export default {
  data() {
    return {
      exam: {}
    }
  },
  props: {
    show: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    closeDialog() {
      this.$emit('closeDialog')
    },
    handleSubmit() {
      this.$emit('add', this.exam)
    },
    handleClose() {
      this.exam = {}
    }
  },
  computed: {
    ...mapGetters(['user'])
  }
}
</script>

<style scoped>

</style>
